package lianxi;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class hashmap {
    public static void main(String[] args) {
        Map<String,String> map = new HashMap<>();
        map.put("张三","张三老婆");
        map.put("郭艾伦","郭艾伦老婆");
        map.put("陈绮贞","陈绮贞老婆");
        map.put("吴宗宪","吴宗宪老婆");
        Set<String> set = map.keySet();
        for (String s : set) {
            String s1 = map.get(s);
            System.out.println(s+"------------"+s1);
        }
        System.out.println("-----------------------");
        Set<Map.Entry<String, String>> entries = map.entrySet();
        for (Map.Entry<String, String> entry : entries) {
            String key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key+"--"+value);
        }
        System.out.println("-------------------");
        map.forEach(
                (String key,String value)->{
                    System.out.println(key+"--"+value);
                }
        );
    }
}
